package com.monkeygroup.mygoplus.view.entrance.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.util.DisplayMetrics;

import com.monkeygroup.mygoplus.MyGoApplication;
import com.monkeygroup.mygoplus.R;
import com.monkeygroup.mygoplus.base.BaseActivity;
import com.monkeygroup.mygoplus.common.utils.LocalInfo;
import com.monkeygroup.mygoplus.view.home.activity.MainActivity;

/**
 * Created by Administrator on 2017/1/20.
 */
public class WelcomeActivity extends BaseActivity {

    Activity activity;

    @Override
    public void setContentView() {
//        Intent intentGroup = new Intent();
//        intentGroup.setAction("com.yuntongxun.ecdemo.inited");
//        sendBroadcast(intentGroup);

        setContentView(R.layout.activity_welcome);
    }

    @Override
    public void initView() {

        activity = WelcomeActivity.this;

    }

    @Override
    public void setListener() {
//        /**初始化容聯云SDK**/
//        SDKCoreHelper.init(this);
//        /**登錄容聯云SDK，注意移植過程中不要遺漏**/
//        MyGoApplication.myECUserid = "zouxu123";
//        SDKCoreHelper.getInstance().setLoginID(MyGoApplication.myECUserid);
    }

    @Override
    public void doEvent() {
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        MyGoApplication.fullScreenWidth = dm.widthPixels;
        MyGoApplication.fullScreenHeight = dm.heightPixels;

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(activity, MainActivity.class);
                startActivity(intent);

                WelcomeActivity.this.finish();
            }
        }, 2000);


        SharedPreferences sh = LocalInfo.getSharePreferences(activity, "first");

        //是否首次进入
        if (sh.getBoolean("firtstart", true)) {
            sh.edit().putBoolean("firtstart", false).commit();
            //    FirstStartActivity.gotoActivity(activity);

//            finish();
        } else {
//            handler.postDelayed(new Runnable() {
//
//                @Override
//                public void run() {
//                    // TODO Auto-generated method stub
//
//                    MainActivity.gotoActivity(activity);
//                    finish();
//
//                }
//            }, 3000);


        }

    }

}

